package com.luoyi.util.ehr;

import cn.hutool.core.io.resource.ResourceUtil;
import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpResponse;
import cn.hutool.http.HttpUtil;
import lombok.extern.slf4j.Slf4j;

/**
 * 批量生成新的招聘任务数据-信息采集
 */
@Slf4j
public class GenerateZpTask {


    public static void main(String[] args) {
        for (int i = 1; i < 58; i++) {
            String str = "13Test16";
            String body = ResourceUtil.readUtf8Str("text/Test2.json");
            body = body.replaceAll(str, "13T3-" + i);
            HttpRequest post = HttpUtil.createPost("http://ehr.test.zoomlion.com/api/ehrCoreService/pa/saveEvent");
            post.body(body);
            post.header("Accept", "application/json, text/plain, */*");
            post.header("Accept-Language", "zh-CN,zh;q=0.9,en;q=0.8");
            post.header("Cache-Control", "no-cache");
            post.header("Connection", "keep-alive");
            post.header("Content-Type", "application/json");
            post.header("Cookie", "b-user-id=b3cc6cb7-edb4-48b5-ab89-e64920ae7715; nS_wcI_5f=zs6ho37arWzQoLXGytgXtYKdLH4HZPj0nmL4xQ==; EHR_TOKEN=1546d5ec8c72b4cdea8c8b37060ea5645; x-user-token=1546d5ec8c72b4cdea8c8b37060ea5645");
            post.header("Origin", "http://ehr.test.zoomlion.com");
            post.header("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/131.0.0.0 Safari/537.36");
            post.header("X-Requested-With", "XMLHttpRequest");
            HttpResponse execute = post.execute();
            log.info("执行i={}，response={}", i, execute.body());
        }



    }
}
